package com.wjw.java.others.bigNumber_;

import java.math.BigInteger;

/**
 * 当long的长度不够用时,我们可以使用BigInteger
 * 当使用BigInteger时,不能直接进行 + - * / 运算
 * 需要使用对应的方法
 */
public class BigInteger_ {
    public static void main(String[] args) {
        //long l = 222222222222222222222222222222L;
        BigInteger a = new BigInteger("222222222222222222222222222222");
        BigInteger b = new BigInteger("2");
        System.out.println(a);
        System.out.println(b);
        //加
        BigInteger addResult = a.add(b);
        System.out.println(addResult);
        //减
        BigInteger subtractResult = a.subtract(b);
        System.out.println(subtractResult);
        //乘
        BigInteger multiplyResult = a.multiply(b);
        System.out.println(multiplyResult);
        //除
        BigInteger divideResult = a.divide(b);
        System.out.println(divideResult);
    }
}
